/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.myorg.nbelang;

import org.openide.util.NbPreferences;

final class NbelangPanel extends javax.swing.JPanel {

    private final NbelangOptionsPanelController controller;

    NbelangPanel(NbelangOptionsPanelController controller) {
        this.controller = controller;
        initComponents();
        // TODO listen to changes in form fields and call controller.changed()
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        compilerName = new javax.swing.JTextField();
        compilerArgs = new javax.swing.JTextField();

        org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(NbelangPanel.class, "NbelangPanel.jLabel1.text")); // NOI18N

        org.openide.awt.Mnemonics.setLocalizedText(jLabel2, org.openide.util.NbBundle.getMessage(NbelangPanel.class, "NbelangPanel.jLabel2.text")); // NOI18N

        compilerName.setText(org.openide.util.NbBundle.getMessage(NbelangPanel.class, "NbelangPanel.compilerName.text")); // NOI18N
        compilerName.setToolTipText(org.openide.util.NbBundle.getMessage(NbelangPanel.class, "NbelangPanel.compilerName.toolTipText")); // NOI18N

        compilerArgs.setText(org.openide.util.NbBundle.getMessage(NbelangPanel.class, "NbelangPanel.compilerArgs.text")); // NOI18N
        compilerArgs.setToolTipText(org.openide.util.NbBundle.getMessage(NbelangPanel.class, "NbelangPanel.compilerArgs.toolTipText")); // NOI18N

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel1)
                    .addComponent(jLabel2))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(compilerName, javax.swing.GroupLayout.DEFAULT_SIZE, 271, Short.MAX_VALUE)
                    .addComponent(compilerArgs, javax.swing.GroupLayout.PREFERRED_SIZE, 271, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(compilerName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(compilerArgs, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );
    }// </editor-fold>//GEN-END:initComponents

    void load() {
        compilerName.setText(NbPreferences.forModule(NbelangPanel.class).
                get("compilerName", "java -jar e.jar"));        
        compilerArgs.setText(NbPreferences.forModule(NbelangPanel.class).
                get("compilerArgs", "--rune")); 
    }

    void store() {
        NbPreferences.forModule(NbelangPanel.class).put("compilerName", 
                compilerName.getText());
        NbPreferences.forModule(NbelangPanel.class).put("compilerArgs", 
               compilerArgs.getText());

    }

    boolean valid() {
        // TODO check whether form is consistent and complete
        return true;
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTextField compilerArgs;
    private javax.swing.JTextField compilerName;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    // End of variables declaration//GEN-END:variables
}
